package com.wl.feign;

import com.wl.domain.AjaxResult;
import com.wl.domain.Store;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class FeignServerFallbackFactory implements FallbackFactory<FeignServer> {
    @Override
    public FeignServer create(Throwable throwable) {
        throwable.printStackTrace();
        return new FeignServer() {
            @Override
            public AjaxResult save(Store store) {
                return AjaxResult.me().setSuccess(false).setMsg("触发熔断！！！服务不可用");
            }
        };
    }
}
